//
//  ProtocolStream.h
//  Protocol
//
//  Created by  user on 11-1-10.
//  Copyright 2011 GuangZhouXuanWu. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "MemoryStream.h"

#import "BitConvert.h"

@interface CProtocolStream : CMemoryStream
{
	int _stringEncoding;
}

@property(nonatomic,assign) int stringEncoding;

-(void)writeInt:(int)nDigit;

-(void)writeNumberInt:(NSNumber*)nNum;

-(void)writeidToInt:(id)data length:(NSNumber*)nLength;

-(int)readInt;

-(NSNumber*)readNumberInt;

-(void)writeShort:(short)nDight;

-(short)readShort;

-(void)writeChar:(char)ch;

-(void)writeIDToChar:(id)data length:(NSNumber*)nLength;

-(char)readChar;

-(void)writeGUID:(GUID)guid;

-(void)writeGUIDByCGUID:(XMSGUID*)guid;

-(void)writeIDToGUID:(id)data length:(NSNumber*)nLength;

-(GUID)readGUID;

-(void)readGUIDs:(CProtocolStream*)ps output:(NSMutableArray**)objs;

-(void)writeString:(NSString*)str;

-(NSString*)readString;

-(void)writeLongLong:(long long)nDight;

-(long long)readLongLong;

-(void)writeDateTime:(NSDate*)datetime;

-(NSDate*)readDateTime;

-(void)toArrays:(id)data dataLength:(int)nLen target:(CProtocolStream*)ps action:(SEL)action;

-(void)toNSArrayObjArrays:(NSArray*)arObjs keyName:(NSString*)szName target:(CProtocolStream*)ps action:(SEL)action;

-(void)toNSArrayObjArrays:(NSArray*)arObjs target:(CProtocolStream*)ps action:(SEL)action;

-(void)fromArraysNSArrayObj:(CProtocolStream*)ps action:(SEL)action output:(NSMutableArray**)objs;

-(NSData*)readData;

-(void)writeData:(NSData*)data;

@end
